<template>
    <view>
        <view v-for="(item,index) in goodsListData" :key="index" @click="handleToInfo(item)">
            <uni-card :is-shadow="false">
                <view class="dis_f_sb_c" >
                    <view>
                        <view class="f_s_20">{{item.bt}}</view>
                        <view class=" m_t_5 m_b_5 dis_f_l_c">
                            {{item.age}}岁 · {{item.education}} · {{item.jobBenefits}} · {{item.districts}}
                        </view>
                    </view>
                    <view>
                        <view style="position: relative">
                            <u-avatar :src="item.wxAvatar" size="60"></u-avatar>
                            <view class="p_5 sex_box" :style="{backgroundColor:item.sex === '女'?'#FF5182':'#0078FF'}">
                                <u-icon name="woman" v-if="item.sex === '女'" size="13" color="#fff"></u-icon>
                                <u-icon name="man" v-else size="13" color="#fff"></u-icon>
                            </view>
                        </view>
                        <view class="c_9 f_s_14">{{item.createTime.substring(0,10)}}</view>
                    </view>
                </view>
                <view class="dis_f_l_c"> <u-icon name="bag" size="20"></u-icon> {{item.bt}}</view>
                <u-divider></u-divider>
                <view class="m_t_10 c_red" v-if="isMy&&item.shzt==3">
                    <view>驳回原因：{{item.shly||''}}</view>
                </view>
            </uni-card>
        </view>
    </view>
</template>
<script>
export default {
    name: "index",
    props: {
        goodsList: {
            type: Array,
            default: []
        },
        isMy: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            goodsListData:this.goodsList||[],
        }
    },
    watch: {
        goodsList(curVal) {
            this.goodsListData=[]
            if (curVal.length>0){
                this.goodsListData = curVal
                for (let i = 0; i <curVal.length; i++) {
                    if (curVal[i].photoUrl){
                        this.goodsListData[i].photoUrl = curVal[i].photoUrl.split(',')[0]
                    }
                }
            }
        }
    },
    methods:{
        handleToInfo(item){
            uni.navigateTo({
                url: '/pages/peopleInfo/index?goodsId='+item.id
            })
        },
        handleLike(item){
            this.$emit('handleLike',item)
        }
    }
}
</script>

<style scoped lang="scss">
.tag_box{
    background-color: #f5f5f5;
    padding: 10rpx 20rpx;
    border-radius: 10rpx;
    color: #66667C;
    font-size: 28rpx;
    margin-right: 10rpx;
}
.sex_box{
    position: absolute;
    right: 20rpx;
    bottom: 0;
    background-color: #FF5182;
    border-radius: 50%
}
</style>
